Add retries when setting maintainer-approval success check#5921
Open
janniklasrose wants to merge 1 commit into
Open
Add retries when setting maintainer-approval success check#5921janniklasrose wants to merge 1 commit into
janniklasrose wants to merge 1 commit into
Conversation
Contributor
Waiting for approvalBased on git history, these people are best suited to review:
Eligible reviewers: Suggestions based on git history. See OWNERS for ownership rules. |
Collaborator
Integration test reportCommit: 50cb996
8 interesting tests: 4 RECOVERED, 4 SKIP
Top 10 slowest tests (at least 2 minutes):
|
radakam
reviewed
Jul 14, 2026
| const delayMs = Number(process.env.MAINTAINER_APPROVAL_VERIFY_DELAY_MS ?? 2000); | ||
|
|
||
| for (let attempt = 1; attempt <= CHECK_VERIFY_ATTEMPTS; attempt++) { | ||
| await github.rest.checks.create({ |
Contributor
There was a problem hiding this comment.
checks.create doesn't seem to be idempotent, so retrying might create duplicate runs, should we do listForRef first and re-create if it's not there?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The
maintainer-approval.jsscript (run by the "PR approval" workflow) creates the requiredmaintainer-approvalstatus check on the PR head SHA when approval is satisfied:There is no verification that this write actually took effect. When
checks.createreturns 2xx but the check does not register on the head commit (GitHub eventual consistency), the workflow run still exits green while the requiredmaintainer-approvalstatus stays stuck as "Expected" in the UI. Because the pending path deliberately posts no check at all, nothing re-establishes it — the PR is silently blocked from the merge queue even though a maintainer approved, until some unrelated event happens to re-run the workflow.This was observed on #5868: the "PR approval" run passed, a maintainer had approved, yet
maintainer-approvalremained "Expected" and the PR would not enter the merge queue.Fix
Route all three success paths through a new
createApprovalCheckhelper that:checks.listForRefto confirm it is visible.core.setFailedif the check never lands, so the run goes red with an actionable message ("re-run this workflow to unblock the merge") instead of green-but-blocking.A red, re-runnable check is far easier to notice and recover from than a silently stuck "Expected" status.
Tests
The test mock now models create → persist → read, with a
flakyCreatesknob to simulate non-persisting writes. Two new cases:setFailed.The retry backoff is overridable via
MAINTAINER_APPROVAL_VERIFY_DELAY_MS(set to0in tests). All 24 tests pass.This pull request and its description were written by Isaac, an AI coding agent.